PersonFactory::PersonFactory(int i , char* nm , int a )
{
	id = i;
	if (nm == NULL);
	else strcpy_s(this->name, nm);
	age = a;
}

class Student :public PersonFactory
{
public:
	int grade;
	Student(int id, char* name, int age, int  grade) :PersonFactory(id, name, age)
	{
		this->grade = grade;
	}
	void PrintInfo()
	{
		PersonFactory::PrintInfo();
		cout << grade << endl;
	
	};
	~Student(){}
};

class Teacher :public PersonFactory
{
public:
	char department[1000];
	Teacher(int id, char* name, int age, char* department) :PersonFactory(id, name, age)
	{
		strcpy_s(this->department, department);
	}
	void PrintInfo()
	{
		PersonFactory::PrintInfo();
		cout << department << endl;
	
	};
	~Teacher(){}
};

PersonFactory* PersonFactory::CreateStudent(int id, char* name, int age, int  grade)
{
	return new Student(id, name, age, grade);
}

PersonFactory* PersonFactory::CreateTeacher(int id, char* name, int age, char* department)
{
	return new Teacher(id, name, age, department);
}


